﻿#include <qglgraphicsviewer.h>
#include <mouseGrabber.h>
#include <manipulatedFrame.h>

class CameraPathPlayer : public MouseGrabber
{
public:
  CameraPathPlayer(int nb) : pathNb(nb) {}
  void checkIfGrabsMouse(int x, int y, const Camera* const camera);
  int yPos() { return 25*pathNb; }

protected:
  void mousePressEvent(QMouseEvent* const, Camera* const camera) { camera->playPath(pathNb); }

private:
  int pathNb;
};


class Spiral
{
public:
  void draw() const;
  void setPosition(const Vec& pos) { mf_.setPosition(pos); }

private:
  ManipulatedFrame mf_;
};


class Viewer : public QGLGraphicsViewer
{
protected :
  virtual void init();
  virtual void draw();
  virtual QString helpString() const;

  void displayPlayers();
  void updatePlayers();

private:
  CameraPathPlayer** player_;
  int nbPlayers_;
  QList<Spiral> spiral_;
};
